package login

import (
	"gin_demo/utility"

	"github.com/gin-gonic/gin"
)

var CLogin = cLogin{}

type cLogin struct{}

//@Summary 登录接口
//@Success 200 {string} string json{"code","message"}
//@Param data body login.LoginReq{} true "登录请求参数"
//@Router  /backend/login  [post]
//@version 1.0
func (l *cLogin) Login(ctx *gin.Context) {
	req := LoginReq{}
	if err := ctx.ShouldBindJSON(&req); err != nil {
		utility.Fail(ctx, err.Error())
	} else {
		Login(ctx, req)
	}
}
